import 'dart:async';
import 'dart:convert';
import 'package:decimal/decimal.dart';
import 'package:dio/dio.dart';

class Api {
  static Dio dio = Dio(BaseOptions(
    baseUrl: 'https://gbf.ziotc.com/gbf-api',
    connectTimeout: 10000,
    receiveTimeout: 30000,
    responseType: ResponseType.json

  ));

  Future getToken() async{
    Response response = await dio.post('/order/test/test/connectionToken',

    );
    var _data = response.data;
    return _data["secret"];
  }

  Future createPaymentIntent(totalPaid) async {
    Response response = await dio.post('/order/test/testCreatePaymentIntent',
        queryParameters: {'totalPaid': totalPaid},

    );
    var _data = response.data;
    return _data;
  }

  Future capturePaymentIntent( paymentIntentId, transferGroupId) async {
    Response response = await dio.post('/order/test/testCapturePaymentIntent',
        queryParameters: {'paymentIntentId': paymentIntentId,"transferGroupId":transferGroupId},

    );
    var _data = response.data;
    return _data;
  }

}
